home *** CD-ROM | disk | FTP | other *** search
/ Java Internet Programming Reference Guide / Java Internet Programming Reference Guide.iso / autorun / java.dir / 00126_12b.txt < prev    next >
Encoding:
Text File  |  1996-01-12  |  6.5 KB  |  921 lines

  1. Eval function
  2.  
  3.  
  4. The eval function is a function built-in to JavaScript. It is not a method associated with any object, but is part of the language itself.
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11. Syntax
  12.  
  13.  
  14.  
  15.  
  16. eval(expression)
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. Description
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. The eval function takes a JavaScript arthimetic expression as its argument and returns the value of the argument as a number.
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. Example
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. Both of the uses of eval in the following example assign the value 42 to the variable result.
  46. x = 6
  47. result = eval((3+3)*7)
  48. result = eval(x*7)
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55. ------------------------------------------------------------------------
  56.  
  57.  
  58.  
  59.  
  60.  
  61. exp method
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. Returns e to the power of its argument, i.e. ex, where x is the argument, and e is Euler's constant, the base of the natural logarithms.
  70.  
  71.  
  72.  
  73.  
  74.  
  75. Syntax
  76.  
  77.  
  78.  
  79.  
  80. exp(arg)
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. Applies to
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94. Math
  95.  
  96.  
  97.  
  98.  
  99.  
  100. Examples
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107. xxx Examples to be supplied.
  108.  
  109.  
  110.  
  111.  
  112.  
  113. See also
  114.  
  115.  
  116.  
  117.  
  118. log method
  119.  
  120.  
  121. ------------------------------------------------------------------------
  122.  
  123.  
  124.  
  125.  
  126.  
  127. fixed method
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135. Causes the calling string object to be displayed in fixed-pitch font in HTML by surrounding it with typewriter text tags,  <fixed>... <fixed>
  136.  
  137.  
  138.  
  139.  
  140.  
  141. Syntax
  142.  
  143.  
  144.  
  145.  
  146. fixed()
  147.  
  148. NOTE: For Beta4, use TT() for this method.
  149.  
  150.  
  151.  
  152.  
  153.  
  154. Description
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161. xxx Description to be supplied.
  162.  
  163.  
  164.  
  165.  
  166.  
  167. Applies to
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174. string
  175.  
  176.  
  177.  
  178.  
  179.  
  180. Examples
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187. xxx Examples to be supplied.
  188.  
  189.  
  190. ------------------------------------------------------------------------
  191.  
  192.  
  193.  
  194.  
  195.  
  196. floor method
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. Returns the greatest integer less than or equal to its argument.
  205.  
  206.  
  207.  
  208.  
  209.  
  210. Syntax
  211.  
  212.  
  213.  
  214.  
  215. floor(arg)
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222. Applies to
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229. Math
  230.  
  231.  
  232.  
  233.  
  234.  
  235. Examples
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242. xxx Examples to be supplied.
  243.  
  244.  
  245.  
  246.  
  247.  
  248. See also
  249.  
  250.  
  251.  
  252.  
  253. ceil method
  254.  
  255.  
  256. ------------------------------------------------------------------------
  257.  
  258.  
  259.  
  260.  
  261.  
  262. focus method
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270. For password, text, and textArea, gives focus to the object.
  271.  
  272.  
  273.  
  274.  
  275.  
  276. Syntax
  277.  
  278.  
  279.  
  280.  
  281. focus()
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288. Description
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295. Use the focus method to navigate to a specific form element and give it focus. You can then either programatically enter a value in the element or let the user enter a value.
  296.  
  297.  
  298.  
  299.  
  300.  
  301. Applies to
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308. password, text, textArea
  309.  
  310.  
  311.  
  312.  
  313.  
  314. Examples
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321. In the following example, the checkPassword function confirms that a user has entered a valid password. If the password is not valid, the focus method returns focus to the password field and the select method highlights it so the user can re-enter the password.
  322.  
  323. function checkPassword(userPass) {
  324.    if (badPassword) {
  325.       alert("Please enter your password again.")
  326.       userPass.focus()
  327.       userPass.select()
  328.    }
  329. }
  330.  
  331. This example assumes that the password is defined as:
  332. <INPUT TYPE=password NAME=userPass>/PRE>
  333.  
  334.  
  335.  
  336.  
  337.  
  338. See also
  339.  
  340.  
  341.  
  342.  
  343. blur, select methods
  344.  
  345.  
  346. ------------------------------------------------------------------------
  347.  
  348.  
  349.  
  350.  
  351.  
  352. fontcolor method
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360. Causes the calling string object to be displayed in the specified color by surrounding it with HTML font color tags,  <FONTCOLOR=color>... <FONTCOLOR>
  361.  
  362.  
  363.  
  364.  
  365.  
  366. Syntax
  367.  
  368.  
  369.  
  370.  
  371. fontcolor(color)
  372.  
  373.  
  374.  
  375. The argument to the method, color, must be a string containing a hashmark (#) followed by a triplet of hexadecimal number pairs. These three pairs represent the red, green, and blue values for the desired color, respectively.
  376.  
  377.  
  378.  
  379.  
  380.  
  381. Description
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388. xxx Description to be supplied.
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Applies to
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401. string
  402.  
  403.  
  404.  
  405.  
  406.  
  407. Examples
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414. xxx Examples to be supplied.
  415.  
  416.  
  417. ------------------------------------------------------------------------
  418.  
  419.  
  420.  
  421.  
  422.  
  423. fontsize method
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431. Causes the calling string object to be displayed in the specified font size by surrounding it with HTML font size tags,  <FONTSIZE=size>... <FONTSIZE>
  432.  
  433.  
  434.  
  435.  
  436.  
  437. Syntax
  438.  
  439.  
  440.  
  441.  
  442. fontsize(size)
  443.  
  444.  
  445.  
  446. The argument to the method, size, must be an integer between one and seven.
  447.  
  448.  
  449.  
  450.  
  451.  
  452. Description
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459. xxx Description to be supplied.
  460.  
  461.  
  462.  
  463.  
  464.  
  465. Applies to
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472. string
  473.  
  474.  
  475.  
  476.  
  477.  
  478. Examples
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485. xxx Examples to be supplied.
  486.  
  487.  
  488.  
  489.  
  490.  
  491. See also
  492.  
  493.  
  494.  
  495.  
  496. big, small methods
  497.  
  498.  
  499. ------------------------------------------------------------------------
  500.  
  501.  
  502.  
  503.  
  504.  
  505. forward method
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513. Loads the next URL in the history list.
  514.  
  515.  
  516.  
  517.  
  518.  
  519. Syntax
  520.  
  521.  
  522.  
  523.  
  524. forward()
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531. Description
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538. This method performs the same action as a user choosing the Forward button in the Navigator. The forward method is the same as go(1).
  539.  
  540.  
  541.  
  542.  
  543.  
  544. Applies to
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551. history
  552.  
  553.  
  554.  
  555.  
  556.  
  557. Examples
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564. xxx Examples to be supplied.
  565.  
  566.  
  567.  
  568.  
  569.  
  570. See also
  571.  
  572.  
  573.  
  574.  
  575. back, go methods
  576.  
  577.  
  578. ------------------------------------------------------------------------
  579.  
  580.  
  581.  
  582.  
  583.  
  584. getDate method
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594. Syntax
  595.  
  596.  
  597.  
  598.  
  599. dateObj.getDate()
  600.  
  601.  
  602.  
  603. where dateObj is a date object.
  604.  
  605.  
  606.  
  607.  
  608.  
  609. Description
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616. Returns the day of the month for the date object, an integer between 1 and 31.
  617.  
  618.  
  619.  
  620.  
  621.  
  622. Applies to
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629. Date
  630.  
  631.  
  632.  
  633.  
  634.  
  635. Examples
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643. The second statement below assigns the value 25 to the variable day, based on the value of the date object Xmas95.
  644.  
  645. Xmas95 = new Date("December 25, 1995 23:15:00")
  646. day = Xmas95.getDate()
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654. See also
  655.  
  656.  
  657.  
  658.  
  659. xxx To be supplied.
  660.  
  661.  
  662. ------------------------------------------------------------------------
  663.  
  664.  
  665.  
  666.  
  667.  
  668. getDay method
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678. Syntax
  679.  
  680.  
  681.  
  682.  
  683. dateObj.getDay() 
  684.  
  685.  
  686.  
  687. where dateObj is a date object.
  688.  
  689.  
  690.  
  691.  
  692.  
  693. Description
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701. Returns the day of the week for the date object, an integer corresponding
  702. to the day of the week: zero for Sunday, one for Monday, two for Tuesday, 
  703. and so on. 
  704.  
  705.  
  706.  
  707.  
  708.  
  709. Applies to
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716. Date
  717.  
  718.  
  719.  
  720.  
  721.  
  722. Examples
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. The second statement below assigns the value 1 to weekday, 
  731. based on the value of the date object Xmas95. This is because December 25, 1995 is a Monday.
  732.  
  733. Xmas95 = new Date("December 25, 1995 23:15:00")
  734. weekday = Xmas95.getDay()
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743. See also
  744.  
  745.  
  746.  
  747.  
  748. xxx To be supplied.
  749.  
  750.  
  751. ------------------------------------------------------------------------
  752.  
  753.  
  754.  
  755.  
  756.  
  757. getHours method
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766. Syntax
  767.  
  768.  
  769.  
  770.  
  771. dateObj.getHours()
  772.  
  773.  
  774.  
  775.  
  776. where dateObj is a date object.
  777.  
  778.  
  779.  
  780.  
  781.  
  782. Description
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790. Returns the hour for the date object, an integer between 0 and 23.
  791.  
  792.  
  793.  
  794.  
  795.  
  796. Applies to
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803. Date
  804.  
  805.  
  806.  
  807.  
  808.  
  809. Examples
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817. The second statement below assigns the value 23 to the variable hours, based on the value of the date object Xmas95.
  818.  
  819. Xmas95 = new Date("December 25, 1995 23:15:00")
  820. hours = Xmas95.getHours()
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829. See also
  830.  
  831.  
  832.  
  833.  
  834. xxx To be supplied.
  835.  
  836.  
  837. ------------------------------------------------------------------------
  838.  
  839.  
  840.  
  841.  
  842.  
  843. getMinutes method
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852. Syntax
  853.  
  854.  
  855.  
  856.  
  857. dateObjgetMinute() 
  858.  
  859.  
  860.  
  861. where dateObj is a date object.
  862.  
  863.  
  864.  
  865.  
  866.  
  867. Description
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875. Returns the minutes in the date object, an integer between 0 and 59.
  876.  
  877.  
  878.  
  879.  
  880.  
  881. Applies to
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888. Date
  889.  
  890.  
  891.  
  892.  
  893.  
  894. Examples
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902. The second statement below assigns the value 15 to the variable minutes, based on the value of the date object Xmas95.
  903.  
  904. Xmas95 = new Date("December 25, 1995 23:15:00")
  905. minutes = Xmas95.getMinutes()
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913. See also
  914.  
  915.  
  916.  
  917.  
  918. xxx To be supplied.
  919.  
  920.  
  921. ------------------------------------------------------------------------